package com.itheima.date.jdk8DateDemo;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class JDK8DateDemo6 {
    public static void main(String[] args) {
        method1();
        method2();
    }

    private static void method2() {
        LocalDateTime of = LocalDateTime.of(2020, 11, 11, 13, 14, 15);
        LocalDateTime localDateTime = of.minusYears(1);
        System.out.println(localDateTime);

        localDateTime = of.minusYears(-1);
        System.out.println(localDateTime);
    }

    private static void method1() {
        LocalDateTime localDateTime = LocalDateTime.of(2020, 11, 11, 11, 12, 13, 14);
        LocalDateTime newLocalDateTime = localDateTime.plusYears(1);
        System.out.println(newLocalDateTime);

        LocalDateTime localDateTime1 = localDateTime.plusYears(-1);
        System.out.println(localDateTime1);
    }
}
